<template>
	<!--
    	作者：1550495493@qq.com
    	时间：2019-08-15
    	描述：基地项目
    -->
	<div class="Announcements">
		<div class="Website-visits">
			<div class="location">
				<div class="location-text fl">
					<img class="location-img fl" src="../../images/ProjectManager/jidi.png" />
					<p class="fr">基地项目</p>
				</div>
				<img class="biaotibg fl" src="../../images/home/biaotibg.png" />
			</div>
			<div class="search-box">
				<div class="fl">
					<div @click="openModal" class="user-box user-name">新增项目需求</div>
				</div>
			</div>
			<div class="PressRelease-list">
				<table>
					<thead>
						<tr>
							<th class="table-text-th2">基地名称</th>
							<th class="table-text-th2">项目名称</th>
							<th class="table-text-th1">项目类型</th>
							<th class="table-text-th1">提出时间</th>
							<th class="table-text-th1">项目详情</th>
							<!--<th class="table-text-th1">合同结束时间</th>-->
							<th class="table-text-th1">项目动态</th>
							<th class="table-text-th1">对接专家</th>
							<th class="table-text-th1">审核状态</th>
							<th class="table-text-th2">操作</th>
						</tr>
					</thead>
					<tbody>
						<tr v-if="total == 0">
				          <td  colspan="9">暂无数据！</td>
				        </tr>
						<tr v-for=" (b,index) in project" :class="index==curIndex?'activeBg':''" @click="choosed(index)">
							<td :title="b.basename"><span class="show-twoline">{{b.basename}}</span> </td>
							<td :title="b.name"><span class="show-twoline">{{b.name}}</span> </td>
							<td>{{b.type == 0?'研究院项目':'横向项目'}}</td>
							<td>{{formatData(b.create_at)}}</td>
							<!--			<td>{{formatData(b.contract_end_time)}}</td>-->
							<td><input @click="viewProject(b.id)" type="button" value="查看" class="delete write" /></td>
							<td><input @click="projectDetails(b)" type="button" value="查看" class="delete write" /></td>
							<td><input @click="demand(b.id)" type="button" value="查看" class="delete write" /></td>

							<!--<td > {{b.release_status == 0?'待发布':'等待筛选'}}</td>-->
							<td>
								<!-- 发布状态-->
								<template v-if="b.release_status == 1">
									<!--项目进度状态-->
									<!--项目筛选-->
									<template v-if="b.process_status == 0">
										<template v-if="b.screen_audit_status == 1">
											待筛选
										</template>
										<template v-else-if="b.screen_audit_status == 2">
											<!--筛选成功-->待立项
										</template>
										<template v-else-if="b.screen_audit_status == 3">
											<button @click="projectModel(b)" class="delete write">筛选失败</button>
										</template>
									</template>
									<template v-else-if="b.process_status == 1">
										待立项
									</template>
									<!--项目立项-->
									<template v-else-if="b.process_status == 2">
										待立项

										<!--<template v-if="b.initiation_audit_status == 1">
                      待立项
                    </template>
                    <template v-if="project.initiation_audit_status == 2">
                      通过
                    </template>
                    <template v-if="project.initiation_audit_status == 3">
                      不通过
                    </template>-->
									</template>
									<!--项目中期-->
									<template v-else-if="b.process_status == 3">
										项目中期
										<!--<template v-if="b.metaphase_audit_status == 1">
                      待审核
                    </template>
                    <template v-if="b.metaphase_audit_status == 2">
                      &lt;!&ndash;中期通过&ndash;&gt;通过
                    </template>
                    <template v-if="b.metaphase_audit_status == 2">
                      不通过
                    </template>-->
									</template>
									<!--项目结题-->
									<template v-else-if="b.process_status == 4">
										<template v-if="b.closure_audit_status == 1">
											项目结题
										</template>
										<template v-if="b.closure_audit_status == 2">
											结题成功
										</template>
										<template v-if="b.closure_audit_status == 3">
											结题失败
										</template>
										<template v-if="b.closure_audit_status == 4">
											限期整改
										</template>
									</template>
								</template>
								<template v-else-if="b.release_status == 0 && b.from_status == 0">
									待发布
								</template>
							</td>
							<td v-if="b.release_status == 0">
								<input @click="edit(b.id)" type="button" value="发布" class="delete write" />
								<input @click="editThe(b.id)" type="button" value="修改" class="delete write" />
								<input @click="delThe(b.id)" type="button" value="删除" class="delete write" />
							</td>
							<td v-else>

							</td>

						</tr>

					</tbody>
				</table>

			</div>
			<!--total  数据总数   size  一页多少条数据   page  当前页码    changge 返回当前选择的页码  改变一页显示条 child  返回值就是一页显示条数  -->
				<pageination :total="total" :size="size" :page="page" :changge="pageFn" @child="obtainChild"></pageination>
		</div>
		<!-- 新增 upd,项目需求-模态框-->
		<div v-show="modelShow" class="tenant-model">
			<div class="tenant-model-content add-upd">
				<header class="tenant-model-header">
					<h3>{{type}}项目需求</h3>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body">
					<div class="search-contain">
						<!--模态框内容板块-->
						<form class="form-box" id="projectForm">
							<div class="form-line input-required">
								<label>基地名称：</label>
								<div class="input-box">
									<select name="areasId" id="areasIdThe">
				                    <option value="">请选择</option>
				                    <option v-for="b in baseSelect" :value="b.id">{{b.name}}</option>
				                  </select>
								</div>
							</div>
							<div class="after">
								<div class="form-line fl input-required">
									<label>项目名称：</label>
									<div class="input-box">
										<input type="text" name="name" v-model="obj.name">
									</div>
								</div>
								<div class="form-line fr star">
									<label><span>*</span>项目类型：</label>
									<select name="type" id="baseType">
                    <option value="">请选择</option>
					                  <option :selected="obj.type === 1" value=1>横向项目</option>
					                  <option :selected="obj.type === 0" value="0">研究院项目</option>
					                </select>
								</div>

								<!--         <div class="form-line fl input-required">
                  <label>项目需求说明书：</label>
                  <div class="input-box">
                    <a>下载</a>
                  </div>
                </div>-->

							</div>
							<div class="form-line introduce star">
								<label class="textarea-label"><span>*</span>项目简介：</label>
								<textarea name="introduction" v-model="obj.introduction" class="input-box textarea-box"></textarea>
							</div>

							<div class="form-line introduce">
								<label class="textarea-template-label">项目需求说明书模板：</label>
								<a @click="download()" class="Public-btn1 uploadbtn handIdFrontA write">下载</a>
							</div>

							<div class="search-boxs imgbox">
								<label><span class="star-sign">*</span>附件上传：</label>
								<input type="hidden" name="demandBookUrl" v-model="demandBookUrl" />
								<input type="file" id="handIdFront" accept=".doc,.docx,.xls,.xlsx,.pdf,.html,.txt,image/jpeg,image/tif,image/gif,image/png,image/bmp,.mp3,.mp4,.wav,.flv,.avi" @change="idFrontImg($event)" style="display: none;" />

								<a class="Public-btn1 uploadbtn handIdFrontA write" @click="touchOffIdInput(1)">上传附件</a>
								<a class="Public-btn1 uploadbtn handIdFrontA write" @click="delAtts()">删除附件</a>
								<ul class="img-box">
									<!-- @click="toSrc(item.url)"-->
									<li v-for="item in FileUpload">{{item.name}}</li>
								</ul>
							</div>
						</form>
					</div>
				</div>
				<footer class="tenant-model-footer">
					<button id="projectButton" class="determine" @click="subProject" v-if="typeThe=='创建'">创建项目</button>
					<button id="projectButton" class="determine" @click="subProject"v-if="typeThe=='修改'">保存</button>
				</footer>
			</div>
		</div>

		<!-- 查看项目-模态框-->
		<div v-show="modelShowView" class="tenant-model">
			<div class="tenant-model-content">
				<header class="tenant-model-header">
					<h3>查看项目详情</h3>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body">
					<div class="search-contain look-detail">
						<!--模态框内容板块-->
						<form class="form-box">
							<div class="form-line">
								<label>基地名称：</label>
								<span  v-for="b in baseSelect" v-if="b.id==obj.areasId">{{b.name}}</span>
							</div>
							<div class="after">
								<div class="form-line fl">
									<label>项目名称：</label>
									<span class="project-name">{{obj.name}}</span>
								</div>
								<div class="form-line fr">
									<label>项目类型：</label>
									<span  v-for="b in baseTypes" v-if="b.id==obj.type" class="project-type">{{b.name}}</span>
								</div>
							</div>
							<div class="form-line introduce">
								<label class="textarea-label">项目简介：</label>
								<span>{{obj.introduction}}</span>
								<!--<textarea name="introduction" readonly v-model="obj.introduction" class="input-box textarea-box closeResize"></textarea>-->
							</div>
							<div class="search-boxs imgbox">
								<label v-show="isUpd">附件上传：</label> &nbsp; &nbsp; <label v-show="isUpd == false" class="instructions"> 项目需求说明书：<a @click="toSrc(obj.demandBookUrl)">预览</a> </label>
								<input type="hidden" name="demandBookUrl" v-model="demandBookUrl" />
								<input type="file" id="handIdFront" accept=".doc,.docx,.xls,.xlsx,.pdf,.html,.txt,image/jpeg,image/tif,image/gif,image/png,image/bmp,.mp3,.mp4,.wav,.flv,.avi" @change="idFrontImg($event)" style="display: none;" />

								<a v-show="isUpd" class="Public-btn1 uploadbtn handIdFrontA " @click="touchOffIdInput(1)">上传附件</a>
								<a v-show="isUpd" class="Public-btn1 uploadbtn handIdFrontA " @click="delAtt()">删除附件</a>
								<ul v-show="isUpd" class="img-box">
									<li v-for="item in FileUpload" @click="toSrc(item.url)">{{item.name}}</li>
								</ul>
							</div>
						</form>
					</div>
				</div>
				<!--     <footer class="tenant-model-footer">
          <button v-show="isUpd" class="determine" @click="subProject">提交</button>
          <button class="determine" @click="closeModel">确定</button>
        </footer>-->
			</div>
		</div>

		<!-- 项目动态-模态框-->
		<div v-if="ProjectModelShow" class="tenant-model">
			<div class="tenant-model-content demandModel">
				<header class="tenant-model-header">
					<h3>查看项目动态</h3>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body">
					<div class="search-contain">
						<!--模态框内容板块-->
						<div class="tab-tit">
							<a href="javascript:;" @click="curId=0" :class="{'cur':curId===0}">项目立项</a>
							<a href="javascript:;" @click="curId=1" :class="{'cur':curId===1}">项目中期</a>
							<a href="javascript:;" @click="curId=2" :class="{'cur':curId===2}">项目结题</a>
						</div>
						<div class="tab-con">
							<div v-show="curId===0">
								<p class="rork-text">专家任务书</p>
								<div class="rork">
									<p>项目名称：
										<span class="project-name">{{projectObj.name}}</span>
									</p>
                  <p>合同开始时间：{{formatData(projectObj.contract_begin_time)}}</p>
                  <p>合同结束时间：{{formatData(projectObj.contract_end_time)}}</p>
									<p>项目负责人：{{projectObj.expert_name}}</p>
									<p>身份证：{{projectObj.the_work}}</p>
									<p v-if="projectObj.initiation_audit_status == 2">项目总金额：{{projectObj.budget_amount}}</p>
									<p v-if="projectObj.initiation_audit_status == 2">任务书附件：<a class="delete write" @click="toSrc(projectObj.task_book_url)">预览</a> </p>
								</div>
							</div>
							<div v-show="curId===1">
								<p class="rork-text">中期进度报告</p>
								<div class="rork">
									<p>项目名称：
										<span class="project-name">{{projectObj.name}}</span>
									</p>
                  <p>合同开始时间：{{formatData(projectObj.contract_begin_time)}}</p>
                  <p>合同结束时间：{{formatData(projectObj.contract_end_time)}}</p>
                  <p>项目负责人：{{projectObj.expert_name}}</p>
                  <p>身份证：{{projectObj.the_work}}</p>
                  <p v-if="projectObj.initiation_audit_status == 2">项目总金额：{{projectObj.budget_amount}}</p>
									<p v-if="projectObj.metaphase_audit_status == 2">经费使用金额：{{projectObj.practical_amount}}</p>
									<p v-if="projectObj.metaphase_audit_status == 2">中期报告附件：<a @click="toSrc(projectObj.metaphase_report_url)" class="delete write" >预览</a></p>
								</div>
							</div>
							<div v-show="curId===2">
								<p class="rork-text">结题报告</p>
								<div class="rork">
									<p>项目名称：
										<span class="project-name">{{projectObj.name}}</span>
									</p>
                  <p>合同开始时间：{{formatData(projectObj.contract_begin_time)}}</p>
                  <p>合同结束时间：{{formatData(projectObj.contract_end_time)}}</p>
                  <p>项目负责人：{{projectObj.expert_name}}</p>
                  <p>身份证：{{projectObj.the_work}}</p>
                  <p v-if="projectObj.initiation_audit_status == 2">项目总金额：{{projectObj.budget_amount}}</p>
									<p v-if="projectObj.closure_audit_status == 2">经费使用金额：{{projectObj.closure_practical_amount}}</p>
									<p v-if="projectObj.closure_audit_status == 2">结题材料附件：<a @click="toSrc(projectObj.closure_material_url)" class="delete write" >预览</a> </p>
									<!--				<p>结题报告附件：<a @click="toSrc(projectObjtask_book_url)">预览</a> <a @click="downloadResources(projectObjtask_book_url)">下载</a></p>-->
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- 对接专家-模态框-->
		<div v-if="demandModelShow" class="tenant-model">
			<div class="tenant-model-content demandModel">
				<header class="tenant-model-header">
					<h3>查看对接专家</h3>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body">
					<div class="search-contain">
						<!--模态框内容板块-->
						<table>
							<tr>
								<th>专家姓名</th>
								<th>身份证号</th>
								<th>二级学科</th>
								<th>合作次数</th>
								<th>工作记录</th>
								<th>联系方式</th>
							</tr>
							<tr v-if="expert==null">
								<td colspan="6">暂无数据</td>
							</tr>
							<tr  v-if="expert!=null">
								<td>{{expert.expert_name}}</td>
								<td>{{expert.the_work}}</td>
								<td>{{expert.second_level}}</td>
							<!--	<td>{{expert.already}}|{{expert.guide}}</td>-->
                <td>    {{ expert.already  == 0?'': expert.already  }} | {{ expert.guide == 0?'': expert.guide }}</td>
								<td @click="rorkRecord(expert.id)">查看</td>
								<td>{{expert.phone_number}}</td>
							</tr>

						</table>

					</div>
				</div>
			</div>
		</div>
		<!-- 工作记录-模态框-->
    <!-- 对接专家团队日志-模态框-->
    <div v-if="WorkModelShow" class="tenant-model">
      <div class="tenant-model-content ">
        <header class="tenant-model-header">
          <h3>查看工作记录</h3>
          <span @click="closeWorkModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain checkbox">
            <!--模态框内容板块-->
            <table>
              <tr>
                <th class="w100">时间</th>
                <th class="w200">事由</th>
                <th class="w200">地点</th>
                <th class="w80">附件</th>
              </tr>
              <tr v-if="logTotal == 0">
                <td colspan="4" class="center">暂无数据！</td>
              </tr>
              <tr v-for="l in logData">
                <td>{{formatData(l.beginTime)}}</td>
                <td :title="l.content"><span class="show-oneline-table">{{l.content}}</span></td>
                <td :title="l.position"><span class="show-oneline-table">{{l.position}}</span></td>
                <td>
                	<button @click="toSrcThe(l.picture)" class="delete write" >预览</button>
                </td>
              </tr>
            </table>
            <pageination :total="logTotal" :size="size" :page="logPage" :changge="pageFnExpertsLog" @child="obtainChildExpertsLog"></pageination>

          </div>
        </div>
        <!--	<footer class="tenant-model-footer">
                      <button class="determine">确定</button>
                  </footer>-->
      </div>
    </div>

    <!-- 塞选失败弹框-模态框-->
    <div v-if="ProjectTerminate" class="tenant-model">
      <div class="tenant-model-content BaseTerminate screening">
        <header class="tenant-model-header">
          <h3>筛选失败原因</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain ">
            <!--模态框内容板块-->
            <div class="screening-failure">
            	<label class="label-one">原因：</label>
            	<span>{{projectObj.screen_audit_msg}}</span>
            </div>
           
            <div class="form-line Website-right">
              <label class="label-one">附件：</label>
                  <input type="button" value="预览" class="write delete" @click="toSrc(projectObj.screen_audit_enclosure_url)" />

            </div>

          </div>
        </div>

      </div>
    </div>


	</div>

</template>
<script src="./BaseProject.js"></script>

<style scoped>
	@import "BaseProject.css";
</style>
